//
//  HSAddTypeVC.m
//  hsdyOrderSystem
//
//  Created by XunFengKJ on 2017/11/9.
//  Copyright © 2017年 赖国锋. All rights reserved.
//

#import "HSAddTypeVC.h"

@interface HSAddTypeVC ()
@property (weak, nonatomic) IBOutlet UITextField *typeNameTX;

@property (weak, nonatomic) IBOutlet UIButton *submitBtn;
@end

@implementation HSAddTypeVC

- (void)viewDidLoad {
    [super viewDidLoad];
    self.navigationItem.title = @"添加分类";
    self.submitBtn.layer.cornerRadius = 25.0f;
}
//提交
- (IBAction)sutmitBtnClick:(id)sender {
    if (!self.typeNameTX.text.length) {
        [SOAutoHideMessageView showMessage:@"请填写分类名称" inView:self.view];
        return;
    }
    WEAKSELF
    [self showLoadingWithClear:YES];
    [XFPostRequest postShopFootTypeAddItemshopId:[BookShareUserInforDefault readUserUid] Name:self.typeNameTX.text success:^(id responseObject) {
        [self hideLoading];
        if ([responseObject[@"status"] intValue] == 200){
            [SOAutoHideMessageView showMessage:@"添加成功" inView:self.view];
            dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.75 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
                [weakSelf.navigationController popViewControllerAnimated:YES];
            });
            LGFLog(@"responseObject - %@",responseObject);
        lNOTIF_POST(@"foodtypeAddSuccessNotification", nil);
        }
        else {
            
        }
    } failure:^(NSError *error) {
        [weakSelf hideLoading];
        [MBProgressHUD showError:LNETWORKERROR];
    }];
    
}


@end
